<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%--
分页区，没有<div class="bottom clearfix">包含
--%>
<c:if test="${sc.totalPageCount>1}">
	<div class="page">
		<c:choose>
			<c:when test="${sc.pageNo<=1}">
				<a  class="no_first" title='<fmt:message key="list.paging.goto1"/>' ></a>
			</c:when>
			<c:otherwise>
				<a  href="javascript:void(0)" class="first" title='<fmt:message key="list.paging.goto1"/>' onclick='gotoPage${pagingId}(1);void(0)'></a>
			</c:otherwise>
		</c:choose>
		
		<c:choose>
			<c:when test="${sc.pageNo<=1}">
				<a  class="no_prev" title='<fmt:message key="list.paging.prev"/>'></a>
			</c:when>
			<c:otherwise>
				<a href="javascript:void(0)" class="prev" title='<fmt:message key="list.paging.prev"/>'	onclick='gotoPage${pagingId}(<c:choose><c:when test="${(sc.pageNo-1) lt 1}">1</c:when><c:otherwise>${sc.pageNo-1}</c:otherwise></c:choose>);void(0)'></a>
			</c:otherwise>
		</c:choose>
		<c:set var="minPager" value="${(sc.totalPageCount-sc.pageNo>=4)?(sc.pageNo >= 5 ? sc.pageNo - 4 : 1):(sc.pageNo >= (5 + 4 - sc.totalPageCount + sc.pageNo) ? (sc.pageNo - 8 + sc.totalPageCount - sc.pageNo) : 1)}" />
		<c:set var="maxPager" value="${(minPager + 8 > sc.totalPageCount) ? sc.totalPageCount : (minPager + 8)}" />
		<c:forEach var="idx" begin="${minPager}" end="${maxPager}" step="1">
			<c:if test="${sc.pageNo!=idx}">
				<a href="javascript:gotoPage${pagingId}(${idx});void(0)"
					title="<fmt:message key="list.paging.no"/>${idx}<fmt:message key="list.paging.page"/>">${idx}
				</a>
			</c:if>
			<c:if test="${sc.pageNo==idx}">
				<a class="curr"> ${idx} </a>
			</c:if>
		</c:forEach>
					
		<c:choose>
			<c:when test="${sc.pageNo>=sc.totalPageCount}">
				<a  class="no_next" title='<fmt:message key="list.paging.next"/>' ></a>
			</c:when>
			<c:otherwise>
				<a href="javascript:void(0)" class="next" title='<fmt:message key="list.paging.next"/>' 	onclick='gotoPage${pagingId}(<c:choose><c:when test="${(sc.pageNo+1) gt sc.totalPageCount}">${sc.totalPageCount}</c:when><c:otherwise>${sc.pageNo+1}</c:otherwise></c:choose>);void(0)'	></a>
			</c:otherwise>
		</c:choose>
		
		<c:choose>
			<c:when test="${sc.pageNo>=sc.totalPageCount}">
				<a class="no_last" title='<fmt:message key="list.paging.gotoEnd"/>'></a>
			</c:when>
			<c:otherwise>
				<a href="javascript:void(0)" class="last" title='<fmt:message key="list.paging.gotoEnd"/>' onclick='gotoPage${pagingId}(${sc.totalPageCount});void(0)'></a>
			</c:otherwise>
		</c:choose>
		
		<input type="text" style="width:40px" class="inputtxt" value="${sc.pageNo}" id="pager_input_${pagingId}" title="<fmt:message key="list.paging.input"/>" onkeypress="if(event.keyCode=='13')return false;"/>
		<input name="" type="button" class="btn2" value="<fmt:message key="list.paging.gotoN"/>" onclick="gotoPage${pagingId}(document.getElementById('pager_input_${pagingId}').value);" />
	</div>
</c:if>
	<input type="hidden" id="PrmPageNo${pagingId}" name="PrmPageNo" value="${sc.pageNo}">
	<script type="text/javascript" defer>
		function gotoPage${pagingId}(pageNo) {
			$j("#PrmPageNo${pagingId}").val(pageNo);
			<%-- 当页面存在fnOnGoToPage时，不自动提交表单，调用fnOnGoToPage --%>
			try{
				fnOnGoToPage${pagingId}(pageNo);
			}catch(e){
				document.getElementById("PrmItemsPerPage").form.submit();
			}
			return false;
		}
	</script>
